<?php

namespace app\common\model;

use app\common\model\Common;
use think\model\concern\SoftDelete;

class SystemRole extends Common
{
    use SoftDelete;
    protected $deleteTime = 'del_time';
    protected $table = 'system_role';
    // 删除
    public function destroyMenu($id){
        SystemMenu::destroy($id);
        $haschild = $this->countRows(['pid'=>$id]);
        if($haschild){
            $menu = $this->getAll(['pid'=>$id],'id,pid');
            foreach($menu as $v){
                $this->destroyMenu($v['id']);
            }
        }
    }
}
